package com.test.springai.controller;

import com.test.springai.service.AdvancedRagService;
import com.test.springai.service.SimpleRagService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * Created with IntelliJ IDEA.
 *
 * @description:
 * @author: liuziyang
 * @since: 9/3/25 11:24 AM
 * @modifiedBy:
 * @version: 1.0
 */
@Slf4j
@RestController
public class RagController {
  @Autowired private SimpleRagService ragService;
  @Autowired private AdvancedRagService completeRagService;

  @GetMapping(value = "/ai/generate", produces = "text/html;charset=UTF-8")
  public Flux<String> generate(
      @RequestParam(value = "message", defaultValue = "我们公司最新的报销政策是什么") String message) {
    return ragService.generateResponse(message);
  }

  @GetMapping(value = "/rag/generate", produces = "text/html;charset=UTF-8")
  public Flux<String> generate2(
      @RequestParam(value = "message", defaultValue = "我们公司最新的报销政策是什么") String message) {
    return completeRagService.advancedGenerateResponse(message);
  }
}
